/*
 * @(#)AuthService.java 2009-2-19
 * Copyright (c) 2008-2015 by CJK
 * All rights reserved.
 */
package net.beyond.core.service;

import java.io.Serializable;
import java.util.List;

import net.beyond.core.entity.Module;
import net.beyond.core.entity.Resource;
import net.beyond.core.entity.User;

/**
 * 系统核心服务层，调用其他 baseService来完成复杂的增删改查
 * 
 * @author Shmiluyu
 * @version 1.000 2009-2-19
 */
public interface CoreService extends Serializable {

	/**
	 * 注册新用户
	 * 
	 * @param newUser
	 * @return
	 */
	User registerUser(User newUser);

	/**
	 * 验证用户
	 * 
	 * @param user
	 * @return
	 */
	User validateUser(User user);

	/**
	 * 检查用户名是否已经存在
	 * 
	 * @param username
	 * @return
	 */
	boolean checkUsernameExists(String username);

	/**
	 * 获取用户有操作权限的Module
	 * 
	 * @param user
	 * @return
	 */
	List<Module> getModuleOfUser(User user);

	/**
	 * 获取一Module下的根资源列表,
	 * 
	 * @param module
	 * @return
	 */
	List<Resource> getRootResourceOfModuleForMenu(Module module);

	/**
	 * 获取子资源列表
	 * 
	 * @param parent
	 * @param resType
	 *            {@link Resource#TYPE_ALL},{@link Resource#TYPE_MENU},
	 *            {@link Resource#TYPE_BUTTON}
	 * @return
	 */
	List<Resource> getChildrenOfResource(Resource parent, int resType);
}
